package top.i51213.fastaction.png;

public class ChunkUtil {
    public static Chunk buildIHDR(int width,int height,int bitDepth,int colorType)
    {
        Chunk chunk = new Chunk();
        byte[] data=Util.link(Util.int2Buff(width),Util.int2Buff(height),Util.bytes2Buff(bitDepth,colorType,0,0,0));
        chunk.setLength(data.length);
        chunk.setType("IHDR");
        chunk.setData(data);
        return chunk;
    }
    public static Chunk BuildIEND()
    {
        Chunk chunk = new Chunk();
        byte[] data = new byte[0];
        chunk.setLength(data.length);
        chunk.setType("IEND");
        chunk.setData(data);
        return chunk;
    }
    public static Chunk build_sRGB()
    {
        Chunk chunk = new Chunk();
        byte[] data = new byte[] { 0 };
        chunk.setLength(data.length);
        chunk.setType("sRGB");
        chunk.setData(data);
        return chunk;
    }
    public static Chunk build_gAMA()
    {
        Chunk chunk = new Chunk();
        byte[] data = new byte[] { 0 ,0, (byte) 0xB1, (byte) 0x8F};
        chunk.setLength(data.length);
        chunk.setType("gAMA");
        chunk.setData(data);
        return chunk;
    }
}
